<?php

declare (strict_types=1);
namespace App\Model;

/**
 * @property int $id 主键ID
 * @property string $title 导出名称
 * @property string $file_type 文件类型excel,word,pdf
 * @property int $sort 排序
 * @property string $export_where 导出条件json
 * @property string $export_file_path 文件路径
 * @property int $status 状态0待处理1处理中2处理成功3处理失败
 * @property int $created_user 创建者
 * @property \Carbon\Carbon $created_at 添加时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property string $deleted_at
 */
class TaskExport extends BaseModel
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'task_exports';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['id', 'title', 'file_type', 'sort','export_model', 'export_where', 'export_file_path', 'status', 'created_user', 'created_at', 'updated_at', 'deleted_at'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'sort' => 'integer', 'status' => 'integer', 'created_user' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
    /**
     * @param  string  $value
     * @return void
     */
    public function setExportWhereAttribute($value)
    {
        $this->attributes['export_where'] = json_encode($value,JSON_UNESCAPED_UNICODE);
    }
    /**
     * @param  string  $value
     * @return void
     */
    public function getExportWhereAttribute($value)
    {
        return json_decode($value,true);
    }
    /**
     * @param  string  $value
     * @return void
     */
    public function setExportFieldAttribute($value)
    {
        $this->attributes['export_field'] = json_encode($value,JSON_UNESCAPED_UNICODE);
    }
    /**
     * @param  string  $value
     * @return void
     */
    public function getExportFieldAttribute($value)
    {
        return json_decode($value,true);
    }
}